import request from '@/utils/request'

//获取用户管理数据
export function getUserList({ page, limit, username }) {
  return request({
    method: 'get',
    url: `/admin/acl/user/${page}/${limit}`,
    params: {
      username
    }
  })
}

//单项删除
export function delUserOne(id) {
  return request({
    method: 'delete',
    url: `/admin/acl/user/remove/${id}`
  })
}

//多项删除
export function delUserAll(data) {
  return request({
    method: 'delete',
    url: `/admin/acl/user/batchRemove`,
    data
  })
}

//添加用户
export function addUser(data) {
  return request({
    method: 'post',
    url: `/admin/acl/user/save`,
    data
  })
}
//修改用户
export function userUpdate(data) {
  return request({
    method: 'put',
    url: '/admin/acl/user/update',
    data
  })
}

//获取用户数据
export function userAssign(userId) {
  return request({
    method: 'get',
    url: `/admin/acl/user/toAssign/${userId}`
  })
}

//分配权限
export function userDoAssign({ userId, roleId }) {
  return request({
    method: 'post',
    url: '/admin/acl/user/doAssign',
    params: {
      userId,
      roleId
    }
  })
}
